﻿using System;
using Framework;

namespace Enterprise.Admin.Handle
{
    public partial class GetPagesDetailJson : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var id = Fq("id").SafeToInt();
            var pageService = new PageService();
            var row = pageService.GetById(id);
            object result = new
                                {
                                    CoPageId = row["CoPageId"].SafeToString(),
                                    CoTitle = row["CoTitle"].SafeToString(),
                                    CoKeyName = row["CoKeyName"].SafeToString(),
                                    CoPath = row["CoPath"].SafeToString(),
                                    CoContent = row["CoContent"].SafeToString(),
                                    CoIsRecommend = row["CoIsRecommend"].SafeToBool(),
                                    CoDate = row["CoDate"].SafeToDateTime().ToString("yyyy-MM-dd HH:mm:ss"),
                                    CoSummary = row["CoSummary"].SafeToBool(),
                                    CoIsPopular = row["CoIsRecommend"].SafeToBool(),
                                    CoIsTop = row["CoIsTop"].SafeToBool(),
                                    CoViews = row["CoViews"].SafeToInt(),
                                    CoIsReserved = row["CoLanguage"].SafeToBool(),
                                    CoReservedUrl = row["CoReservedUrl"].SafeToString(),
                                    CoColumnId = row["CoColumnId"].SafeToString(),
                                    CoColumnPath = row["CoColumnPath"].SafeToString(),
                                    CoLanguage = row["CoLanguage"].SafeToString(),
                                    CoKeyWord = row["CoKeyWord"].SafeToString(),
                                    CoDescription = row["CoDescription"].SafeToString(),
                                    CoAuthor = row["CoAuthor"].SafeToString()
                                };
            Json(result);
        }
    }
}